package org.jeecg.modules.scm.controller;

import cn.hutool.core.util.URLUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.CommonUtils;
import org.jeecg.modules.scm.entity.*;
import org.jeecg.modules.scm.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;

 /**
 * @Description: 贷后管理
 * @Author: jeecg-boot
 * @Date:   2021-12-01
 * @Version: V1.0
 */
@Api(tags="贷后管理")
@RestController
@RequestMapping("/afterLoan")
@Slf4j
public class ScmAfterLoanController extends JeecgController<ScmAfterLoan, IScmAfterLoanService> {
	@Autowired
	private IScmAfterLoanService scmAfterLoanService;
	
	/**
	 * 分页列表查询
	 *
	 * @param scmAfterLoan
	 * @param pageNo
	 * @param pageSize
	 * @param req
	 * @return
	 */
	@AutoLog(value = "贷后基本信息-分页列表查询")
	@ApiOperation(value="贷后基本信息-分页列表查询", notes="贷后基本信息-分页列表查询")
	@GetMapping(value = "/afterLoanInfo/list")
	public Result<?> queryPageList(ScmAfterLoan scmAfterLoan,
								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
								   HttpServletRequest req) {
		QueryWrapper<ScmAfterLoan> queryWrapper = QueryGenerator.initQueryWrapper(scmAfterLoan, req.getParameterMap());
		Page<ScmAfterLoan> page = new Page<ScmAfterLoan>(pageNo, pageSize);
		IPage<ScmAfterLoan> pageList = scmAfterLoanService.page(page, queryWrapper);
		return Result.OK(pageList);
	}
	
	/**
	 *   添加
	 *
	 * @param scmAfterLoan
	 * @return
	 */
	@AutoLog(value = "贷后基本信息-添加")
	@ApiOperation(value="贷后基本信息-添加", notes="贷后基本信息-添加")
	@PostMapping(value = "/afterLoanInfo/add")
	public Result<?> add(@RequestBody ScmAfterLoan scmAfterLoan) {
		LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
		scmAfterLoan.setApplyBy(user.getId());
		scmAfterLoan.setHandlerId(user.getId());
		scmAfterLoanService.save(scmAfterLoan);
		return Result.OK("添加成功！");
	}
	
	/**
	 *  编辑
	 *
	 * @param scmAfterLoan
	 * @return
	 */
	@AutoLog(value = "贷后基本信息-编辑")
	@ApiOperation(value="贷后基本信息-编辑", notes="贷后基本信息-编辑")
	@PutMapping(value = "/afterLoanInfo/edit")
	public Result<?> edit(@RequestBody ScmAfterLoan scmAfterLoan) {
		scmAfterLoanService.updateById(scmAfterLoan);
		return Result.OK("编辑成功!");
	}
	
	/**
	 *   通过id删除
	 *
	 * @param id
	 * @return
	 */
	@AutoLog(value = "贷后基本信息-通过id删除")
	@ApiOperation(value="贷后基本信息-通过id删除", notes="贷后基本信息-通过id删除")
	@DeleteMapping(value = "/afterLoanInfo/delete")
	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
		scmAfterLoanService.removeById(id);
		return Result.OK("删除成功!");
	}
	
	/**
	 *  批量删除
	 *
	 * @param ids
	 * @return
	 */
	@AutoLog(value = "贷后基本信息-批量删除")
	@ApiOperation(value="贷后基本信息-批量删除", notes="贷后基本信息-批量删除")
	@DeleteMapping(value = "/afterLoanInfo/deleteBatch")
	public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
		this.scmAfterLoanService.removeByIds(Arrays.asList(ids.split(",")));
		return Result.OK("批量删除成功!");
	}
	
	/**
	 * 通过id查询
	 *
	 * @param id
	 * @return
	 */
	@AutoLog(value = "贷后基本信息-通过id查询")
	@ApiOperation(value="贷后基本信息-通过id查询", notes="贷后基本信息-通过id查询")
	@GetMapping(value = "/afterLoanInfo/queryById")
	public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
		ScmAfterLoan scmAfterLoan = scmAfterLoanService.getById(id);
		if(scmAfterLoan==null) {
			return Result.error("未找到对应数据");
		}
		return Result.OK(scmAfterLoan);
	}

	 @Autowired
	 private IScmAfterLoanInspectService scmAfterLoanInspectService;

	 /**
	  * 分页列表查询
	  *
	  * @param scmAfterLoanInspect
	  * @param pageNo
	  * @param pageSize
	  * @param req
	  * @return
	  */
	 @AutoLog(value = "贷后检查登记-分页列表查询")
	 @ApiOperation(value="贷后检查登记-分页列表查询", notes="贷后检查登记-分页列表查询")
	 @GetMapping(value = "/afterLoanInspect/list")
	 public Result<?> afterLoanInspectQueryPageList(ScmAfterLoanInspect scmAfterLoanInspect,
									@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
									@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
									HttpServletRequest req) {
		 QueryWrapper<ScmAfterLoanInspect> queryWrapper = QueryGenerator.initQueryWrapper(scmAfterLoanInspect, req.getParameterMap());
		 Page<ScmAfterLoanInspect> page = new Page<ScmAfterLoanInspect>(pageNo, pageSize);
		 IPage<ScmAfterLoanInspect> pageList = scmAfterLoanInspectService.page(page, queryWrapper);
		 return Result.OK(pageList);
	 }

	 /**
	  *   添加
	  *
	  * @param scmAfterLoanInspect
	  * @return
	  */
	 @AutoLog(value = "贷后检查登记-添加")
	 @ApiOperation(value="贷后检查登记-添加", notes="贷后检查登记-添加")
	 @PostMapping(value = "/afterLoanInspect/add")
	 public Result<?> afterLoanInspectAdd(@RequestBody ScmAfterLoanInspect scmAfterLoanInspect) {
		 LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
		 scmAfterLoanInspect.setApplyBy(user.getId());
		 scmAfterLoanInspectService.save(scmAfterLoanInspect);
		 return Result.OK("添加成功！");
	 }

	 /**
	  *  编辑
	  *
	  * @param scmAfterLoanInspect
	  * @return
	  */
	 @AutoLog(value = "贷后检查登记-编辑")
	 @ApiOperation(value="贷后检查登记-编辑", notes="贷后检查登记-编辑")
	 @PutMapping(value = "/afterLoanInspect/edit")
	 public Result<?> afterLoanInspectEdit(@RequestBody ScmAfterLoanInspect scmAfterLoanInspect) {
		 scmAfterLoanInspectService.updateById(scmAfterLoanInspect);
		 return Result.OK("编辑成功!");
	 }

	 /**
	  *   通过id删除
	  *
	  * @param id
	  * @return
	  */
	 @AutoLog(value = "贷后检查登记-通过id删除")
	 @ApiOperation(value="贷后检查登记-通过id删除", notes="贷后检查登记-通过id删除")
	 @DeleteMapping(value = "/afterLoanInspect/delete")
	 public Result<?> afterLoanInspectDelete(@RequestParam(name="id",required=true) String id) {
		 scmAfterLoanInspectService.removeById(id);
		 return Result.OK("删除成功!");
	 }

	 /**
	  *  批量删除
	  *
	  * @param ids
	  * @return
	  */
	 @AutoLog(value = "贷后检查登记-批量删除")
	 @ApiOperation(value="贷后检查登记-批量删除", notes="贷后检查登记-批量删除")
	 @DeleteMapping(value = "/afterLoanInspect/deleteBatch")
	 public Result<?> afterLoanInspectDeleteBatch(@RequestParam(name="ids",required=true) String ids) {
		 this.scmAfterLoanInspectService.removeByIds(Arrays.asList(ids.split(",")));
		 return Result.OK("批量删除成功!");
	 }

	 /**
	  * 通过id查询
	  *
	  * @param id
	  * @return
	  */
	 @AutoLog(value = "贷后检查登记-通过id查询")
	 @ApiOperation(value="贷后检查登记-通过id查询", notes="贷后检查登记-通过id查询")
	 @GetMapping(value = "/afterLoanInspect/queryById")
	 public Result<?> afterLoanInspectQueryById(@RequestParam(name="id",required=true) String id) {
		 ScmAfterLoanInspect scmAfterLoanInspect = scmAfterLoanInspectService.getById(id);
		 if(scmAfterLoanInspect==null) {
			 return Result.error("未找到对应数据");
		 }
		 return Result.OK(scmAfterLoanInspect);
	 }

	 @Autowired
	 private IScmLoanService scmLoanService;

	 /**
	  * 分页列表查询
	  *
	  * @param scmLoan
	  * @param pageNo
	  * @param pageSize
	  * @param req
	  * @return
	  */
	 @AutoLog(value = "放款登记-分页列表查询")
	 @ApiOperation(value="放款登记-分页列表查询", notes="放款登记-分页列表查询")
	 @GetMapping(value = "/loan/list")
	 public Result<?> loanQueryPageList(ScmLoan scmLoan,
										@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
										@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
										HttpServletRequest req) {
		 QueryWrapper<ScmLoan> queryWrapper = QueryGenerator.initQueryWrapper(scmLoan, req.getParameterMap());
		 Page<ScmLoan> page = new Page<ScmLoan>(pageNo, pageSize);
		 IPage<ScmLoan> pageList = scmLoanService.page(page, queryWrapper);
		 return Result.OK(pageList);
	 }

	 /**
	  *   添加
	  *
	  * @param scmLoan
	  * @return
	  */
	 @AutoLog(value = "放款登记-添加")
	 @ApiOperation(value="放款登记-添加", notes="放款登记-添加")
	 @PostMapping(value = "/loan/add")
	 public Result<?> loanAdd(@RequestBody ScmLoan scmLoan) {
		 LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
		 scmLoan.setApplyBy(user.getId());
		 scmLoanService.save(scmLoan);
		 return Result.OK("添加成功！");
	 }

	 /**
	  *  编辑
	  *
	  * @param scmLoan
	  * @return
	  */
	 @AutoLog(value = "放款登记-编辑")
	 @ApiOperation(value="放款登记-编辑", notes="放款登记-编辑")
	 @PutMapping(value = "/loan/edit")
	 public Result<?> loanEdit(@RequestBody ScmLoan scmLoan) {
		 scmLoanService.updateById(scmLoan);
		 return Result.OK("编辑成功!");
	 }

	 /**
	  *   通过id删除
	  *
	  * @param id
	  * @return
	  */
	 @AutoLog(value = "放款登记-通过id删除")
	 @ApiOperation(value="放款登记-通过id删除", notes="放款登记-通过id删除")
	 @DeleteMapping(value = "/loan/delete")
	 public Result<?> loanDelete(@RequestParam(name="id",required=true) String id) {
		 scmLoanService.removeById(id);
		 return Result.OK("删除成功!");
	 }

	 /**
	  *  批量删除
	  *
	  * @param ids
	  * @return
	  */
	 @AutoLog(value = "放款登记-批量删除")
	 @ApiOperation(value="放款登记-批量删除", notes="放款登记-批量删除")
	 @DeleteMapping(value = "/loan/deleteBatch")
	 public Result<?> loanDeleteBatch(@RequestParam(name="ids",required=true) String ids) {
		 this.scmLoanService.removeByIds(Arrays.asList(ids.split(",")));
		 return Result.OK("批量删除成功!");
	 }

	 /**
	  * 通过id查询
	  *
	  * @param id
	  * @return
	  */
	 @AutoLog(value = "放款登记-通过id查询")
	 @ApiOperation(value="放款登记-通过id查询", notes="放款登记-通过id查询")
	 @GetMapping(value = "/loan/queryById")
	 public Result<?> loanQueryById(@RequestParam(name="id",required=true) String id) {
		 ScmLoan scmLoan = scmLoanService.getById(id);
		 if(scmLoan==null) {
			 return Result.error("未找到对应数据");
		 }
		 return Result.OK(scmLoan);
	 }

	 @Autowired
	 private IScmFiveLevelClassifyChangeService scmFiveLevelClassifyChangeService;

	 /**
	  * 分页列表查询
	  *
	  * @param scmFiveLevelClassifyChange
	  * @param pageNo
	  * @param pageSize
	  * @param req
	  * @return
	  */
	 @AutoLog(value = "五级分类变动登记-分页列表查询")
	 @ApiOperation(value="五级分类变动登记-分页列表查询", notes="五级分类变动登记-分页列表查询")
	 @GetMapping(value = "/fiveLevelClassifyChange/list")
	 public Result<?> fiveLevelClassifyChangeQueryPageList(ScmFiveLevelClassifyChange scmFiveLevelClassifyChange,
														   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
														   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
														   HttpServletRequest req) {
		 QueryWrapper<ScmFiveLevelClassifyChange> queryWrapper = QueryGenerator.initQueryWrapper(scmFiveLevelClassifyChange, req.getParameterMap());
		 Page<ScmFiveLevelClassifyChange> page = new Page<ScmFiveLevelClassifyChange>(pageNo, pageSize);
		 IPage<ScmFiveLevelClassifyChange> pageList = scmFiveLevelClassifyChangeService.page(page, queryWrapper);
		 return Result.OK(pageList);
	 }

	 /**
	  *   添加
	  *
	  * @param scmFiveLevelClassifyChange
	  * @return
	  */
	 @AutoLog(value = "五级分类变动登记-添加")
	 @ApiOperation(value="五级分类变动登记-添加", notes="五级分类变动登记-添加")
	 @PostMapping(value = "/fiveLevelClassifyChange/add")
	 public Result<?> fiveLevelClassifyChangeAdd(@RequestBody ScmFiveLevelClassifyChange scmFiveLevelClassifyChange) {
		 LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
		 scmFiveLevelClassifyChange.setApplyBy(user.getId());
		 scmFiveLevelClassifyChangeService.save(scmFiveLevelClassifyChange);
		 return Result.OK("添加成功！");
	 }

	 /**
	  *  编辑
	  *
	  * @param scmFiveLevelClassifyChange
	  * @return
	  */
	 @AutoLog(value = "五级分类变动登记-编辑")
	 @ApiOperation(value="五级分类变动登记-编辑", notes="五级分类变动登记-编辑")
	 @PutMapping(value = "/fiveLevelClassifyChange/edit")
	 public Result<?> fiveLevelClassifyChangeEdit(@RequestBody ScmFiveLevelClassifyChange scmFiveLevelClassifyChange) {
		 scmFiveLevelClassifyChangeService.updateById(scmFiveLevelClassifyChange);
		 return Result.OK("编辑成功!");
	 }

	 /**
	  *   通过id删除
	  *
	  * @param id
	  * @return
	  */
	 @AutoLog(value = "五级分类变动登记-通过id删除")
	 @ApiOperation(value="五级分类变动登记-通过id删除", notes="五级分类变动登记-通过id删除")
	 @DeleteMapping(value = "/fiveLevelClassifyChange/delete")
	 public Result<?> fiveLevelClassifyChangeDelete(@RequestParam(name="id",required=true) String id) {
		 scmFiveLevelClassifyChangeService.removeById(id);
		 return Result.OK("删除成功!");
	 }

	 /**
	  *  批量删除
	  *
	  * @param ids
	  * @return
	  */
	 @AutoLog(value = "五级分类变动登记-批量删除")
	 @ApiOperation(value="五级分类变动登记-批量删除", notes="五级分类变动登记-批量删除")
	 @DeleteMapping(value = "/fiveLevelClassifyChange/deleteBatch")
	 public Result<?> fiveLevelClassifyChangeDeleteBatch(@RequestParam(name="ids",required=true) String ids) {
		 this.scmFiveLevelClassifyChangeService.removeByIds(Arrays.asList(ids.split(",")));
		 return Result.OK("批量删除成功!");
	 }

	 /**
	  * 通过id查询
	  *
	  * @param id
	  * @return
	  */
	 @AutoLog(value = "五级分类变动登记-通过id查询")
	 @ApiOperation(value="五级分类变动登记-通过id查询", notes="五级分类变动登记-通过id查询")
	 @GetMapping(value = "/fiveLevelClassifyChange/queryById")
	 public Result<?> fiveLevelClassifyChangeQueryById(@RequestParam(name="id",required=true) String id) {
		 ScmFiveLevelClassifyChange scmFiveLevelClassifyChange = scmFiveLevelClassifyChangeService.getById(id);
		 if(scmFiveLevelClassifyChange==null) {
			 return Result.error("未找到对应数据");
		 }
		 return Result.OK(scmFiveLevelClassifyChange);
	 }

	 @Autowired
	 private IScmCollateralInsuranceService scmCollateralInsuranceService;

	 /**
	  * 分页列表查询
	  *
	  * @param scmCollateralInsurance
	  * @param pageNo
	  * @param pageSize
	  * @param req
	  * @return
	  */
	 @AutoLog(value = "抵押物保险登记-分页列表查询")
	 @ApiOperation(value="抵押物保险登记-分页列表查询", notes="抵押物保险登记-分页列表查询")
	 @GetMapping(value = "/collateralInsurance/list")
	 public Result<?> collateralInsuranceQueryPageList(ScmCollateralInsurance scmCollateralInsurance,
													   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
													   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
													   HttpServletRequest req) {
		 QueryWrapper<ScmCollateralInsurance> queryWrapper = QueryGenerator.initQueryWrapper(scmCollateralInsurance, req.getParameterMap());
		 Page<ScmCollateralInsurance> page = new Page<ScmCollateralInsurance>(pageNo, pageSize);
		 IPage<ScmCollateralInsurance> pageList = scmCollateralInsuranceService.page(page, queryWrapper);
		 return Result.OK(pageList);
	 }

	 /**
	  *   添加
	  *
	  * @param scmCollateralInsurance
	  * @return
	  */
	 @AutoLog(value = "抵押物保险登记-添加")
	 @ApiOperation(value="抵押物保险登记-添加", notes="抵押物保险登记-添加")
	 @PostMapping(value = "/collateralInsurance/add")
	 public Result<?> collateralInsuranceAdd(@RequestBody ScmCollateralInsurance scmCollateralInsurance) {
		 LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
		 scmCollateralInsurance.setApplyBy(user.getId());
		 scmCollateralInsuranceService.save(scmCollateralInsurance);
		 return Result.OK("添加成功！");
	 }

	 /**
	  *  编辑
	  *
	  * @param scmCollateralInsurance
	  * @return
	  */
	 @AutoLog(value = "抵押物保险登记-编辑")
	 @ApiOperation(value="抵押物保险登记-编辑", notes="抵押物保险登记-编辑")
	 @PutMapping(value = "/collateralInsurance/edit")
	 public Result<?> collateralInsuranceEdit(@RequestBody ScmCollateralInsurance scmCollateralInsurance) {
		 scmCollateralInsuranceService.updateById(scmCollateralInsurance);
		 return Result.OK("编辑成功!");
	 }

	 /**
	  *   通过id删除
	  *
	  * @param id
	  * @return
	  */
	 @AutoLog(value = "抵押物保险登记-通过id删除")
	 @ApiOperation(value="抵押物保险登记-通过id删除", notes="抵押物保险登记-通过id删除")
	 @DeleteMapping(value = "/collateralInsurance/delete")
	 public Result<?> collateralInsuranceDelete(@RequestParam(name="id",required=true) String id) {
		 scmCollateralInsuranceService.removeById(id);
		 return Result.OK("删除成功!");
	 }

	 /**
	  *  批量删除
	  *
	  * @param ids
	  * @return
	  */
	 @AutoLog(value = "抵押物保险登记-批量删除")
	 @ApiOperation(value="抵押物保险登记-批量删除", notes="抵押物保险登记-批量删除")
	 @DeleteMapping(value = "/collateralInsurance/deleteBatch")
	 public Result<?> collateralInsuranceDeleteBatch(@RequestParam(name="ids",required=true) String ids) {
		 this.scmCollateralInsuranceService.removeByIds(Arrays.asList(ids.split(",")));
		 return Result.OK("批量删除成功!");
	 }

	 /**
	  * 通过id查询
	  *
	  * @param id
	  * @return
	  */
	 @AutoLog(value = "抵押物保险登记-通过id查询")
	 @ApiOperation(value="抵押物保险登记-通过id查询", notes="抵押物保险登记-通过id查询")
	 @GetMapping(value = "/collateralInsurance/queryById")
	 public Result<?> collateralInsuranceQueryById(@RequestParam(name="id",required=true) String id) {
		 ScmCollateralInsurance scmCollateralInsurance = scmCollateralInsuranceService.getById(id);
		 if(scmCollateralInsurance==null) {
			 return Result.error("未找到对应数据");
		 }
		 return Result.OK(scmCollateralInsurance);
	 }

	 @Autowired
	 private IScmCollateralEvaluateService scmCollateralEvaluateService;

	 /**
	  * 分页列表查询
	  *
	  * @param scmCollateralEvaluate
	  * @param pageNo
	  * @param pageSize
	  * @param req
	  * @return
	  */
	 @AutoLog(value = "押品评估登记-分页列表查询")
	 @ApiOperation(value="押品评估登记-分页列表查询", notes="押品评估登记-分页列表查询")
	 @GetMapping(value = "/collateralEvaluate/list")
	 public Result<?> collateralEvaluateQueryPageList(ScmCollateralEvaluate scmCollateralEvaluate,
													  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
													  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
													  HttpServletRequest req) {
		 QueryWrapper<ScmCollateralEvaluate> queryWrapper = QueryGenerator.initQueryWrapper(scmCollateralEvaluate, req.getParameterMap());
		 Page<ScmCollateralEvaluate> page = new Page<ScmCollateralEvaluate>(pageNo, pageSize);
		 IPage<ScmCollateralEvaluate> pageList = scmCollateralEvaluateService.page(page, queryWrapper);
		 return Result.OK(pageList);
	 }

	 /**
	  *   添加
	  *
	  * @param scmCollateralEvaluate
	  * @return
	  */
	 @AutoLog(value = "押品评估登记-添加")
	 @ApiOperation(value="押品评估登记-添加", notes="押品评估登记-添加")
	 @PostMapping(value = "/collateralEvaluate/add")
	 public Result<?> collateralEvaluateAdd(@RequestBody ScmCollateralEvaluate scmCollateralEvaluate) {
		 LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
		 scmCollateralEvaluate.setApplyBy(user.getId());
		 scmCollateralEvaluateService.save(scmCollateralEvaluate);
		 return Result.OK("添加成功！");
	 }

	 /**
	  *  编辑
	  *
	  * @param scmCollateralEvaluate
	  * @return
	  */
	 @AutoLog(value = "押品评估登记-编辑")
	 @ApiOperation(value="押品评估登记-编辑", notes="押品评估登记-编辑")
	 @PutMapping(value = "/collateralEvaluate/edit")
	 public Result<?> collateralEvaluateEdit(@RequestBody ScmCollateralEvaluate scmCollateralEvaluate) {
		 scmCollateralEvaluateService.updateById(scmCollateralEvaluate);
		 return Result.OK("编辑成功!");
	 }

	 /**
	  *   通过id删除
	  *
	  * @param id
	  * @return
	  */
	 @AutoLog(value = "押品评估登记-通过id删除")
	 @ApiOperation(value="押品评估登记-通过id删除", notes="押品评估登记-通过id删除")
	 @DeleteMapping(value = "/collateralEvaluate/delete")
	 public Result<?> collateralEvaluateDelete(@RequestParam(name="id",required=true) String id) {
		 scmCollateralEvaluateService.removeById(id);
		 return Result.OK("删除成功!");
	 }

	 /**
	  *  批量删除
	  *
	  * @param ids
	  * @return
	  */
	 @AutoLog(value = "押品评估登记-批量删除")
	 @ApiOperation(value="押品评估登记-批量删除", notes="押品评估登记-批量删除")
	 @DeleteMapping(value = "/collateralEvaluate/deleteBatch")
	 public Result<?> collateralEvaluateDeleteBatch(@RequestParam(name="ids",required=true) String ids) {
		 this.scmCollateralEvaluateService.removeByIds(Arrays.asList(ids.split(",")));
		 return Result.OK("批量删除成功!");
	 }

	 /**
	  * 通过id查询
	  *
	  * @param id
	  * @return
	  */
	 @AutoLog(value = "押品评估登记-通过id查询")
	 @ApiOperation(value="押品评估登记-通过id查询", notes="押品评估登记-通过id查询")
	 @GetMapping(value = "/collateralEvaluate/queryById")
	 public Result<?> collateralEvaluateQueryById(@RequestParam(name="id",required=true) String id) {
		 ScmCollateralEvaluate scmCollateralEvaluate = scmCollateralEvaluateService.getById(id);
		 if(scmCollateralEvaluate==null) {
			 return Result.error("未找到对应数据");
		 }
		 return Result.OK(scmCollateralEvaluate);
	 }

	 @Autowired
	 private IScmAuditReportService scmAuditReportService;

	 /**
	  * 分页列表查询
	  *
	  * @param scmAuditReport
	  * @param pageNo
	  * @param pageSize
	  * @param req
	  * @return
	  */
	 @AutoLog(value = "审计报告登记-分页列表查询")
	 @ApiOperation(value="审计报告登记-分页列表查询", notes="审计报告登记-分页列表查询")
	 @GetMapping(value = "/scmAuditReport/list")
	 public Result<?> scmAuditReportQueryPageList(ScmAuditReport scmAuditReport,
									@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
									@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
									HttpServletRequest req) {
		 QueryWrapper<ScmAuditReport> queryWrapper = QueryGenerator.initQueryWrapper(scmAuditReport, req.getParameterMap());
		 Page<ScmAuditReport> page = new Page<ScmAuditReport>(pageNo, pageSize);
		 IPage<ScmAuditReport> pageList = scmAuditReportService.page(page, queryWrapper);
		 return Result.OK(pageList);
	 }

	 /**
	  *   添加
	  *
	  * @param scmAuditReport
	  * @return
	  */
	 @AutoLog(value = "审计报告登记-添加")
	 @ApiOperation(value="审计报告登记-添加", notes="审计报告登记-添加")
	 @PostMapping(value = "/scmAuditReport/add")
	 public Result<?> scmAuditReportAdd(@RequestBody ScmAuditReport scmAuditReport) {
		 LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
		 scmAuditReport.setApplyBy(user.getId());
		 scmAuditReportService.save(scmAuditReport);
		 return Result.OK("添加成功！");
	 }

	 /**
	  *  编辑
	  *
	  * @param scmAuditReport
	  * @return
	  */
	 @AutoLog(value = "审计报告登记-编辑")
	 @ApiOperation(value="审计报告登记-编辑", notes="审计报告登记-编辑")
	 @PutMapping(value = "/scmAuditReport/edit")
	 public Result<?> scmAuditReportEdit(@RequestBody ScmAuditReport scmAuditReport) {
		 scmAuditReportService.updateById(scmAuditReport);
		 return Result.OK("编辑成功!");
	 }

	 /**
	  *   通过id删除
	  *
	  * @param id
	  * @return
	  */
	 @AutoLog(value = "审计报告登记-通过id删除")
	 @ApiOperation(value="审计报告登记-通过id删除", notes="审计报告登记-通过id删除")
	 @DeleteMapping(value = "/scmAuditReport/delete")
	 public Result<?> scmAuditReportDelete(@RequestParam(name="id",required=true) String id) {
		 scmAuditReportService.removeById(id);
		 return Result.OK("删除成功!");
	 }

	 /**
	  *  批量删除
	  *
	  * @param ids
	  * @return
	  */
	 @AutoLog(value = "审计报告登记-批量删除")
	 @ApiOperation(value="审计报告登记-批量删除", notes="审计报告登记-批量删除")
	 @DeleteMapping(value = "/scmAuditReport/deleteBatch")
	 public Result<?> scmAuditReportDeleteBatch(@RequestParam(name="ids",required=true) String ids) {
		 this.scmAuditReportService.removeByIds(Arrays.asList(ids.split(",")));
		 return Result.OK("批量删除成功!");
	 }

	 /**
	  * 通过id查询
	  *
	  * @param id
	  * @return
	  */
	 @AutoLog(value = "审计报告登记-通过id查询")
	 @ApiOperation(value="审计报告登记-通过id查询", notes="审计报告登记-通过id查询")
	 @GetMapping(value = "/scmAuditReport/queryById")
	 public Result<?> scmAuditReportQueryById(@RequestParam(name="id",required=true) String id) {
		 ScmAuditReport scmAuditReport = scmAuditReportService.getById(id);
		 if(scmAuditReport==null) {
			 return Result.error("未找到对应数据");
		 }
		 return Result.OK(scmAuditReport);
	 }

	 @AutoLog(value = "附件上传")
	 @ApiOperation(value = "附件上传")
	 @PostMapping(value = "/uploadAccessory")
	 public Result<?> uploadContract(@RequestParam(name = "file") MultipartFile file) {
		 String url = CommonUtils.upload(file, "/afterLoan/accessory", CommonConstant.UPLOAD_TYPE_MINIO);
		 String path = URLUtil.getPath(url);
		 return Result.OK(path);
	 }

}
